<!DOCTYPE html>
<html>
<head>
<meta charset="ISO-8859-1">
<title>Crear Canvas</title>
</head>
<body>
<h1>Crear Canvas</h1>


<canvas height="300px" width="300px" id="micanvas"></canvas>

<script>
var canvas = document.getElementById("micanvas");
var ctx = canvas.getContext("2d");

ctx.fillStyle = "rgb(255,0,0)";
ctx.fillRect(20,20,100,100);

ctx.fillStyle = "rgb(0,255,0)";
ctx.fillRect(60,60,140,140);

ctx.fillStyle = "rgb(0,0,255)";
ctx.fillRect(100,100,180,180);
</script>


<br/><br/>
<hr>
Art&iacute;culo disponible en: <a href="http://lineadecodigo.com/html5/crear-un-canvas-en-html5/">http://lineadecodigo.com/html5/crear-un-canvas-en-html5/</a><br/>
<a href="http://lineadecodigo.com" title="Linea de Codigo">lineadecodigo.com</a>

</body>
</html>